#include <rtthread.h>

#include <stdio.h>

#include <io/rttADC.h>

static int adc(int argc, char **argv)
{
    NXMFC::rttADC a;
    int cnt = 100;

    if (!a.open(":dev/adc0"))
    {
        printf("open fail\r\n");
        return -1;
    }

    while (cnt-- > 0)
    {
        float v;

        v = a.voltage(11);
        printf("V[%.2f]\r\n", v);
        rt_thread_mdelay(1000);
    }

    a.close();

    return 0;
}
MSH_CMD_EXPORT(adc, test adc);
